<?php
namespace App\Utility\Traits;

trait DbBackupTrait
{
    protected $dataList; // 待处理分页处理
    protected $finalDataList = []; // 处理完的分页数据
    protected $page;
    protected $limit = 15; // 默认每页15条数据
    /**
     * 数据列表分页化
     */
    protected function PageList()
    {
        $this->page = input('page', 1);
        $this->limit = input('limit', 15);

        $this->dataList;
        $start = $this->limit * ($this->page - 1);
        $this->finalDataList['dataCount'] = count($this->dataList);
        $this->finalDataList['list'] = array_slice($this->dataList, $start, $this->limit);
    }
}
